import path from 'path';
import { fileURLToPath } from 'url';

// Constants and fixtures for nodejs tests on our Monaco dataset.
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Somewhere in Monaco
// http://www.openstreetmap.org/#map=18/43.73185/7.41772
export const three_test_coordinates = [[7.41337, 43.72956],
                                       [7.41546, 43.73077],
                                       [7.41862, 43.73216]];

export const two_test_coordinates = three_test_coordinates.slice(0, 2);

export const test_tile = {'at': [17059, 11948, 15], 'size': 159125};

// Test files generated by the routing engine; check test/data
let data_path, mld_data_path, test_memory_path;

if (process.env.OSRM_DATA_PATH !== undefined) {
    data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "ch/monaco.osrm");
    mld_data_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "mld/monaco.osrm");
    test_memory_path = path.join(path.resolve(process.env.OSRM_DATA_PATH), "test_memory");
    console.log('Setting custom data path to ' + data_path);
} else {
    data_path = path.resolve(path.join(__dirname, "../data/ch/monaco.osrm"));
    mld_data_path = path.resolve(path.join(__dirname, "../data/mld/monaco.osrm"));
    test_memory_path = path.resolve(path.join(__dirname, "../data/test_memory"));
}

export { data_path, mld_data_path, test_memory_path };
